package personnel.department.dao.entity;

import java.io.Reader;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="adopted_to_structural")
public class AdoptedToStructural implements UniqueObject {
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id")
	private Long id;
	
	@Column(name="number_contract")
	private Integer numberContract;
	
	@ManyToOne(cascade=CascadeType.ALL)
	private Work work;

	@Column(name="rate")
	private Float rate;
	
	@ManyToOne(cascade=CascadeType.ALL)
	private StructualSubdivision subdivision;
	
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="employee_Id")
	private Employee employee;
	
	public AdoptedToStructural(List<Object> params) {
		this.numberContract = Integer.parseInt((String) params.get(0));
		this.rate = Float.parseFloat((String) params.get(1));
		Work work = new Work();
		work.setBaseWork((String) params.get(2));
		work.setExternalWork((String) params.get(3));
		work.setInternalWork((String) params.get(4));
		this.work = work;
		this.subdivision = new StructualSubdivision((String) params.get(5));
	}
	
	public AdoptedToStructural() {
	}

	public Long getId() {
		return id;
	}

	public Integer getNumberContract() {
		return numberContract;
	}

	public Work getWork() {
		return work;
	}

	public Float getRate() {
		return rate;
	}

	public StructualSubdivision getSubdivision() {
		return subdivision;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setNumberContract(Integer numberContract) {
		this.numberContract = numberContract;
	}

	public void setWork(Work work) {
		this.work = work;
	}

	public void setRate(Float rate) {
		this.rate = rate;
	}

	public void setSubdivision(StructualSubdivision subdivision) {
		this.subdivision = subdivision;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}
	
	
}
